<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./vuejs/vue.js"></script>
</head>
<body>
    <style>
    .fade-enter-active, .fade-leave-active{
            transition: opacity .5s ease;
        }
        .fade-enter, .fade-leave-to{
            opacity: 0;
        }
    </style>

    <template id="example1">
        <span>我是登录组件</span>   
    </template>
    <template id="example2">
        <span>我是注册组件</span>
    </template>


    <div id="app">
        <a href="javascript:;" @click="aaa= 'example1' ">登录</a>
        <a href="javascript:;" @click="aaa= 'example2' ">注册</a>
        <transition name="fade" mode="out-in">
           <component is="aaa"></component>
        </transition>
    </div>


    <script>
        Vue.component('example',{template:'#example1'})
        Vue.component('example',{template:'#example2'})
        var vm  = new Vue({
            el:'#app',
            data:{
                aaa:''
            }
        });


    </script>
</body>
</html>